﻿using GalaSoft.MvvmLight;
using System.Collections.ObjectModel;

using GalaSoft.MvvmLight.Command;

using GalaSoft.MvvmLight.Messaging;
using db;
using System;

namespace SGTv2.ViewModel
{
    /// <summary>
    /// This class contains properties that a View can data bind to.
    /// <para>
    /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
    /// </para>
    /// <para>
    /// You can also use Blend to data bind with the tool's support.
    /// </para>
    /// <para>
    /// See http://www.galasoft.ch/mvvm/getstarted
    /// </para>
    /// </summary>
    public class DepositoViewModel : ViewModelBase
    {
        /// <summary>
        /// Initializes a new instance of the ABMDepositosViewModel class.
        /// </summary>
        private Uri _ContenidoPagina;
        private ObservableCollection<Mercaderia> _Mercaderias;
        private Sector _SectorNuevo;
        private Deposito _DepositoSeleccionado;
        private Deposito _NuevoDepositoACrear;
        private Mercaderia _MercaderiaSeleccionada;
        public RelayCommand NuevoSector { get; private set; }
        public RelayCommand AgregarSector { get; private set; }
        public RelayCommand CrearDeposito { get; private set; }
        public RelayCommand EstablecerDepositoActual { get; private set; }



        public Uri ContenidoPagina
        {
            get { return _ContenidoPagina; }
            set
            {
                _ContenidoPagina = value;
                RaisePropertyChanged("ContenidoPagina");
            }
        }
        
        
        
        public Deposito NuevoDepositoACrear
        {
            get { return _NuevoDepositoACrear; }
            set
            {
                _NuevoDepositoACrear = value;
                RaisePropertyChanged("NuevoDepositoACrear");
            }
        }

        public Deposito DepositoSeleccionado
        {
            get { return _DepositoSeleccionado; }
            set
            {
                _DepositoSeleccionado = value;
                RaisePropertyChanged("DepositoSeleccionado");
            }
        }
        
        
 

        public ObservableCollection<Mercaderia> Mercaderias
        {
            get { return _Mercaderias; }
            set
            {
                //esto no puede ser asi, ver de cambiar
                _Mercaderias = value;
                RaisePropertyChanged("Mercaderias");
            }
        }

                
        public Mercaderia MercaderiaSeleccionada
        {
            get { return _MercaderiaSeleccionada; }
            set
            {
                _MercaderiaSeleccionada = value;
                RaisePropertyChanged("MercaderiaSeleccionada");
            }
        }

        public Sector SectorNuevo
        {
            get { return _SectorNuevo; }
            set
            {
                _SectorNuevo = value;
                RaisePropertyChanged("SectorNuevo");
            }
        }




        public DepositoViewModel()
        {
            if (IsInDesignMode)
            {
            ///    // Code runs in Blend --> create design time data.
            }
            else
            {
           //     _Mercaderias = ManejadorDepositos.GetMercaderias();
               /* NuevoSector = new RelayCommand(MostarNuevoSector);
                AgregarSector = new RelayCommand(AgregarNuevoSectorColeccion);
                CrearDeposito = new RelayCommand(GuardarDeposito);
                EstablecerDepositoActual = new RelayCommand(EstablecerDepositoActualAccion);
                _SectorNuevo = new Sector();*/
                inicializacion();
              
            }
        }

        private void inicializacion()
        {
            ContenidoPagina = new Uri("/Views/Pages/NuevoDepositoPage1.xaml", UriKind.Relative);
        }

     
 

     

  

     

      
        ////public override void Cleanup()
        ////{
        ////    // Clean own resources if needed

        ////    base.Cleanup();
        ////}
    }
}